package com.rzhd.coursepatriarch.common.utils.permission;

import android.Manifest;
import android.content.Context;
import android.support.annotation.NonNull;

import java.util.List;

/**
 * RxPermission 权限工具类
 *
 * @author yql
 * @date: 2018/12/10.
 */
public class RxPermissionUtils {
    private Context mContext;
    private RxPermissionUtilsCallback mUtilsCallback;

    /**
     * 上传拿图片需要的权限
     */
    public static final String[] picturePermissions = {
            Manifest.permission.READ_EXTERNAL_STORAGE,
            Manifest.permission.READ_EXTERNAL_STORAGE,
            Manifest.permission.CAMERA};

    /**
     * 录制视频\直播 需要的权限
     */
    public static final String[] recordPermissions = {
            Manifest.permission.RECORD_AUDIO,
            Manifest.permission.READ_EXTERNAL_STORAGE,
            Manifest.permission.CAMERA};

    public RxPermissionUtils(Context context, RxPermissionUtilsCallback utilsCallback) {
        mContext = context;
        mUtilsCallback = utilsCallback;
    }

    public interface RxPermissionUtilsCallback {
        /**
         * 权限请求成功
         *
         * @param permissions
         */
        void onGranted(@NonNull List<String> permissions);

        /**
         * 权限请求失败
         *
         * @param permissions
         */
        void onDenied(@NonNull List<String> permissions);

        /**
         * 权限设置返回
         */
        void onComeback();
    }
}
